package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pojo.Railing;
import com.example.vo.pet.RailingDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author w
 */
@Repository
public interface RailingMapper extends BaseMapper<Railing> {

    @Results(id = "fenceInfoMap", value = {
            @Result(column = "railing_id", property = "railingId", javaType = Integer.class, id = true),
            @Result(column = "railing_longitude", property = "railingLongitude", javaType = Double.class),
            @Result(column = "railing_latitude", property = "railingLatitude", javaType = Double.class),
            @Result(column = "railing_radius", property = "railingRadius", javaType = Double.class)
    })
    @Select("Select * from railing where pet_id = #{petId}")
    List<RailingDTO> selectFencesInfoByPetId(@Param("petId")Integer petId);
}
